package controllerfxml.comprehensive;

import java.io.IOException;

import client.SimpleFactoryClient;
import client.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class MainController {

	@FXML
	private Button btn_1;

	@FXML
	private Button btn_2;

	@FXML
	private Button btn_3;

	@FXML
	private Button btn_4;

	@FXML
	private Button btn_5;

	@FXML
	private Button btn_6;

	@FXML
	private Button btn_7;

	@FXML
	private Button btn_8;

	@FXML
	private Button btn_9;

	@FXML
	private Button btn_10;

	private Stage stage;

	public MainController() {
		this.stage = new Stage();

		FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Main.fxml"));
		fxmlLoader.setController(this);
		Scene scene = null;
		try {
			scene = new Scene(fxmlLoader.load(), 700, 500);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		this.stage.setScene(scene);
	}

	public void show() {
		this.stage.show();
	}

	@FXML
	private void initialize() {
		btn_1.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				SingletonClient singletonClient=new SingletonClient();
				try {
					singletonClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});

		btn_2.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				SingletonClient singletonClient=new SingletonClient();
				try {
					singletonClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_3.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				SimpleFactory f=new SimpleFactory();
				try {
					f.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_4.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				Factory f=new Factory();
				try {
					f.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_5.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				Stage stage=new Stage();
				AbstractFactory f=new AbstractFactory();
				try {
					f.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_6.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				ObjectAdapterClient objectAdapterClient=new ObjectAdapterClient();
				try {
					objectAdapterClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}
		});
		btn_7.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				ClassAdapterClient classAdapterClient=new ClassAdapterClient();
				try {
					classAdapterClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_8.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				CompositeClient compositeClient=new CompositeClient();
				try {
					compositeClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_9.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				CompositeClient compositeClient=new CompositeClient();
				try {
					compositeClient.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
		btn_10.setOnAction(new EventHandler<ActionEvent>() {

			@Override
			public void handle(ActionEvent event) {
				// TODO Auto-generated method stub
				Stage stage=new Stage();
				HibernateClient client=new HibernateClient();
				try {
					client.start(stage);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});

	}
}
